<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*   1.内置对象：系统自带的对象，Array，Object
           2.MDN：内置对象的说明书
           3.学习方法：
              3.1这个对象是干什么的
              3.2输入：参数的个数及数据类型
              3.3处理：方法的作用
              3.4输出：方法的结果

              函数的形参用[]包裹，这个形参可有可无
      */

        console.log(Math.PI);
        // 绝对值
        console.log(Math.abs('-1'));
        console.log(Math.abs(5));

        // ceil 向上取整
        console.log(Math.ceil(5.5));
        console.log(Math.ceil(-5.5));

        // 四舍五入
        console.log(Math.round(5.2));
        console.log(Math.round(5.6));

        // 作业：求最大值，最小值，string，number，array，object，boolean
        console.log(Math.max(10, 20));
        var x = 10,
            y = -20;
        var z = Math.min(x, y);

        const myFalse = new Boolean(false); // initial value of false
        const g = Boolean(myFalse); // initial value of true
        const myString = new String('Hello'); // string object
        const s = Boolean(myString); // initial value of true

        var a = "a";
        var b = "b";
        if (a < b) // true
            print(a + " is less than " + b);
        else if (a > b)
            print(a + " is greater than " + b);
        else
            print(a + " and " + b + " are equal.");

        new Number(value);
        var a = new Number('123'); // a === 123 is false
        var b = Number('123'); // b === 123 is true
        a instanceof Number; // is true
        b instanceof Number; // is false

        let fruits = ['Apple', 'Banana']

        console.log(fruits.length)
        fruits.forEach(function (item, index, array) {
            console.log(item, index)
        })
        // Apple 0
        // Banana 1
    </script>
</body>

</html>